<template>
    <div>
        <mt-tabbar fixed v-model="selected">
            <mt-tab-item id="首页">
              <!-- <img slot="icon" src="https://gss0.bdstatic.com/5eR1dDebRNRTm2_p8IuM_a/resource/jingcai-mobile/img/home-quiz-1.3dffebc.png"> -->
               <img slot="icon" src="../assets/caiz.png">
                购彩大厅
            </mt-tab-item>
            <mt-tab-item :id='islogin=="false"||islogin==undefined?"登录":"竞猜记录"' >
              <!-- <img slot="icon" src="https://gss0.bdstatic.com/5eR1dDebRNRTm2_p8IuM_a/resource/jingcai-mobile/img/home-quiz-4.bf3fcb7.png"> -->
              <img slot="icon" src="../assets/history.png">
                历史
           </mt-tab-item>
            <mt-tab-item id="我的">
              <!-- <img slot="icon" src="https://gss0.bdstatic.com/5eR1dDebRNRTm2_p8IuM_a/resource/jingcai-mobile/img/app-login.981d485.png"> -->
               <img slot="icon" src="../assets/user_red.png" >
                账户
            </mt-tab-item>
        </mt-tabbar>
    </div>
</template>
<script>
export default {
    data() {
        return {
            selected: this.$route.name,
             islogin:sessionStorage.getItem('login'),
        }
    },
    watch: {
        selected: function(val, oldVal) {
            // 这里就可以通过 val 的值变更来确定
            this.$route.meta.noPageAnimation = false
            this.$router.push({
                name: val,
            });

            //  console.log('footer:'+this.$route)
        }
    },
//      mounted() {// 图片上传  https://www.jianshu.com/p/c4e1c8475a60

// this.pp()
//     },
//     methods:{
//         prizeShop:function (img) {
//                  var canvas = document.createElement("canvas");
//             canvas.width = img.width;
//             canvas.height = img.height;
//             var ctx = canvas.getContext("2d");
//             ctx.drawImage(img, 0, 0, img.width, img.height);
//             var ext = img.src.substring(img.src.lastIndexOf(".")+1).toLowerCase();
//             var dataURL = canvas.toDataURL("image/"+ext);
//             return dataURL;
//         },
//         pp:function(){
//             const _this=this;
//                 var img = "https://gss0.bdstatic.com/5bVWsj_p_tVS5dKfpU_Y_D3/res/r/image/2017-07-11/76ebc18806b6517605b5ebcc0a478f16.jpg";
//                 var image = new Image();
//                 image.src = img;
//                 image.onload = function(){
//                     var base64 = _this.prizeShop(image);
//                     console.log(base64);
//                 }
//         },
//     }
}
</script>
<style>


</style>
